/**
 * 
 */
package command;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * PatternBox: "Client" implementation.
 * <ul>
 * <li>creates a ConcreteCommand object and sets its receiver.</li>
 * </ul>
 * 
 * @author <a href="mailto:dirk.ehms@patternbox.com">Dirk Ehms</a>
 * @author lx
 */
public class Client {

	/** stores the Receiver instance of the Client */
	private final TV fReceiver;

	/**
	 * This construtor creates a Client instance and stores the given Receiver.
	 */
	public Client(TV receiver) {
		super();
		fReceiver = receiver;
	}

	/**
	 * This method creates a ConcreteCommand instance and specifies a Receiver
	 * object.
	 */
	public void initConcreteCommand() {

		Invoker invoker = new Invoker();

		// invoker.storeCommand(play);
		invoker.execute();
	}

	public static void main(String[] args) {
		TV tv = new TV();
		PlayCommand play = new PlayCommand(tv);
//		play.execute();

		PauseCommand pause = new PauseCommand(tv);
//		pause.execute();

		StopCommand stop = new StopCommand(tv);
//		stop.execute();

		LinkedList<Command> list = new LinkedList<Command>();
		list.add(play);
		list.add(pause);
		list.add(stop);
		
		for (Iterator iterator = list.iterator(); iterator.hasNext();) {
			Command command = (Command) iterator.next();
			System.out.println("Client.main()"+command);
			command.execute();
			
		}

	}
}
